﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Web_Blog
{
    public partial class TaoBaiViet1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //Kiểm tra đã đăng nhập chưa
            if (Session["uID"] == null)
            {
                Session["url"] = Request.RawUrl;
                Response.Redirect("DangNhap.aspx");
            }


            Object.UserProfileObject up = new Object.UserProfileObject();
            if (Request.QueryString["u"] == null)
                up = Controler.Account.LoadProfile(int.Parse(Session["uID"].ToString()));
            else
                up = Controler.Account.LoadProfile(int.Parse(Request.QueryString["u"].ToString()));

        }

        protected void btn_DangBai_Click(object sender, EventArgs e)
        {
            
            Object.SendPostObject p = new Object.SendPostObject();
            p.Uid = int.Parse(Session["uID"].ToString());
            p.Title = txt_tieude.Text;
            p.Contents = fck_noidung.Value;
            Response.Redirect("BaiViet.aspx?p=" + Controler.POST.Send(p).ToString());
        }
    }
}